<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">


<ui:composition template="/WEB-INF/templates/newsmaintemplate.xhtml">
	<ui:define name="metadata">
		<!-- save cagtThdId in sessionScope, DO NOT USE flash Scope.  -->
		<f:metadata>
			<f:viewParam name="#{constants.nameToValueMap.CATEGORY__NEWS_ID}" value="${sessionScope.ctgtNewsId}"></f:viewParam>
		</f:metadata>
	</ui:define>
	<ui:define name="navigation">
		<h:panelGroup>
			<f:event type="preRenderComponent" listener="#{newsBackingBean.calculateNavMap()}" />
			<ui:include src="/navigationNews.xhtml"></ui:include>
		</h:panelGroup>
	</ui:define>

	<ui:define name="leftpage">
		<h:form>
			<p:dataList lazy="true" value="#{newsBackingBean.lazyNewsDataModel}" var="news" paginator="true" paginatorAlwaysVisible="false"
				paginatorTemplate="{PreviousPageLink}  {CurrentPageReport} {NextPageLink} " type="none" effectSpeed="slow" rows="5" paginatorPosition="bottom">
				<f:facet name="header">
					<h1>
						#{newsBackingBean.belongingNewsCategory.categoryName}
						<h:panelGroup
							rendered="#{login.isCurrLogInUser(newsBackingBean.belongingNewsCategory.categoryOwner) || login.userInSysadmin ||  login.isCurrentUserInRole(constants.nameToValueMap.NewsPoster_Role_Type)}">
							<h:link value="#{msgs.manageNews_button}" outcome="listnewsmanage.xhtml" styleClass="mangeButton">
								<f:param name="#{constants.nameToValueMap.CATEGORY__NEWS_ID}" value="#{newsBackingBean.belongingNewsCategory.id}"></f:param>
							</h:link>
						</h:panelGroup>
					</h1>
				</f:facet>
				<li class="thumb">
					<div class="content">
						<div class="readFloor_comment_right">
							<h:panelGroup styleClass="thumbnail" rendered="#{! empty news.thumbPicURL}">
								<h:link outcome="viewnews" styleClass="longstyle">
									<f:param name="id" value="#{news.id}"></f:param>
									<img src="#{news.thumbPicURL}" width="100px" height="75px" />
								</h:link>
							</h:panelGroup>
							<h:panelGroup styleClass="txt" layout="block">
								<h:link value="#{news.subject}" outcome="viewnews" styleClass="title">
									<f:param name="id" value="#{news.id}"></f:param>
								</h:link>
								<p>
									<h:outputText value="#{news.description}" />
								</p>
							</h:panelGroup>
						</div>
					</div>
				</li>
			</p:dataList>
		</h:form>
	</ui:define>
	<ui:define name="rightpage">
		<h:form>
			<p:dataList lazy="true" value="#{newsCacheEjb.getRecentNews(newsBackingBean.belongingNewsCategory)}" var="news" itemType="disc" rows="15">
				<f:facet name="header">#{msgs.NEWSFORYOU}</f:facet>
				<h:link value="#{news.subject}" outcome="viewnews" styleClass="longstyle">
					<f:param name="id" value="#{news.id}"></f:param>
				</h:link>
			</p:dataList>
		</h:form>
	</ui:define>

</ui:composition>

</html>